package com.login.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.login.action.fo.ManageFinaMoneyFO;
import com.login.action.fo.ManageFinaWayFO;

public class ManagingFinancialMoneyDaoImpl implements
		IManagingFinancialMoneyDao {
	public static Logger log = Logger.getLogger(ManagingFinancialMoneyDaoImpl.class);
	private SqlMapClientTemplate sqlMapClienet;

	public boolean deleteByIdString(String idString) {
		boolean isFlag = true;
		if (idString == null || "".equals(idString))
			return false;
		String ids = idString.substring(0,idString.length()-1);
		try {
			   Map<String,String> paraMap = new HashMap<String,String>();
			   paraMap.put("ids", ids);
				sqlMapClienet.delete("deleteFinalMoneyById",paraMap);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return isFlag;
	}

	public int saveSysmenu(Map<String, Object> parameMap) {
		Object obj = null;
		try{
		obj = sqlMapClienet.insert("managingFinancialMoneyInsert",parameMap);
		}
		catch(Exception e)
		{
			log.info("插入对象出错");
		}
		if (obj == null) {
			return 0;
		}
		return (Integer) obj;
	}

	public List<ManageFinaMoneyFO> searchFinaList() {
		List<ManageFinaMoneyFO> result = null;
		try{
			 result = sqlMapClienet.queryForList("managingFinancialMoney");

		}
		catch(Exception e)
		{
			log.info("查询对象出错");
		}
		return result;
	}

	public int searchFinaListNum() {
		Object obj = null;
		try{
			 obj = sqlMapClienet.queryForObject("managingFinancialMoneyNum");

		}
		catch(Exception e)
		{
			log.info("查询对象出错");
		}
		if (obj == null) {
			return 0;
		}
		return (Integer) obj;
	}

	public void setSqlMapClienet(SqlMapClientTemplate sqlMapClienet) {
		this.sqlMapClienet = sqlMapClienet;
	}
	

}
